package com.aisino.mplearning.config;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author guochuantao
 * @version 1.0
 * @description aop
 * @since 2024/9/14 上午11:26
 */
@Component
@Aspect
public class DataAspect {
    /**
     * value 就是execution表达式
     * argNames 参数列表
     */
    @Pointcut("execution(public * com.aisino.mplearning.service.UserService.*())")
    public void pointCut() {

    }


    @Before("pointCut()")
    public void before(JoinPoint joinPoint) {
        System.out.println();
        System.out.println("====>前置通知开始执行.....");
        System.out.println("joinPoint = " + joinPoint);
    }

    @After("pointCut()")
    public void after(JoinPoint joinPoint) {
        System.out.println("====>后置通知开始执行.......");
        System.out.println("joinPoint = " + joinPoint);
        System.out.println();
    }


}
